import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../style/ns_style.dart';
import 'brick/widget/ns_text_widget.dart';

///业务实心Button
class NSSolidButton extends StatelessWidget {
  final String? text;
  final EdgeInsets? margin;
  final Function()? onTap;
  final double? width;
  final double? height;
  final double? radius;
  final double? fontSize;
  final bool? shrinkWrap;
  final Color? color;
  final Color? textColor;

  NSSolidButton({
    super.key,
    this.text,
    this.margin,
    this.onTap,
    this.width,
    this.height,
    this.radius,
    this.fontSize,
    this.shrinkWrap,
    this.color,
    this.textColor,
  });

  @override
  Widget build(BuildContext context) {
    return NSText(
      onTap: onTap,
      text: text ?? "",
      textColor: textColor ?? Colors.white,
      fontSize: fontSize ?? 15.sp,
      shrinkWrap: shrinkWrap ?? false,
      width: width,
      height: height ?? 48.h,
      fontWeight: FontWeight.bold,
      margin: margin,
      textAlign: TextAlign.center,
      radius: radius ?? 24.h,
      gradientBegin: Alignment.centerLeft,
      gradientEnd: Alignment.centerRight,
      gradientStartColor: color ?? kAppLeftColor,
      gradientEndColor: color ?? kAppRightColor,
      alignment: Alignment.center,
    );
  }
}

///业务空心Button
class NSStrokeButton extends NSSolidButton {
  final Color? strokeColor;

  NSStrokeButton({
    this.strokeColor,
    super.textColor,
    super.key,
    super.text,
    super.margin,
    super.onTap,
    super.width,
    super.height,
    super.radius,
    super.fontSize,
    super.shrinkWrap,
  });

  @override
  Widget build(BuildContext context) {
    return NSText(
      onTap: onTap,
      text: text ?? "",
      textColor: textColor ?? kAppThemeColor,
      fontSize: fontSize ?? 14.sp,
      shrinkWrap: shrinkWrap ?? false,
      width: width,
      height: height ?? 48.w,
      fontWeight: FontWeight.bold,
      margin: margin,
      textAlign: TextAlign.center,
      radius: radius ?? 24.w,
      strokeColor: strokeColor ?? kAppThemeColor,
      strokeWidth: 1.w,
      alignment: Alignment.center,
    );
  }
}
